package br.uff.busuffweb.model;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author jthiago
 */
@NamedQueries({
    @NamedQuery(name = "PontoCircuito.getTodos",
    query = "select pc from PontoCircuito pc order by pc.id"),
    
    @NamedQuery(name = "PontoCircuito.getPorCircuito",
    query = "select pc from PontoCircuito pc " +
            " where pc.circuito = ?"),
    
    @NamedQuery(name = "PontoCircuito.getPorPonto",
    query = "select pc from PontoCircuito pc " +
            " where pc.ponto = ?"),
    
    @NamedQuery(name = "PontoCircuito.getPorCircuitoEOrdem",
    query = "select pc from PontoCircuito pc " +
            " where pc.circuito = ? and pc.ordem = ?"),
    
    @NamedQuery(name = "PontoCircuito.getPorPontoEOrdem",
    query = "select pc from PontoCircuito pc " +
            " where pc.ponto = ? and pc.ordem = ?")
})
@Entity
@SequenceGenerator(sequenceName = "seq_pontoCircuito", name = "Sequencia")
@Table(name = "pontoCircuito")
public class PontoCircuito implements Serializable {
    
    @Id
    @GeneratedValue(generator = "Sequencia", strategy = GenerationType.AUTO)
    private Long id;
    
    @ManyToOne
    @JoinColumn(name="idCircuito")
    private Circuito circuito;
    
    @ManyToOne
    @JoinColumn(name="idPonto")
    private Ponto ponto;
    
    private Integer ordem;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Circuito getCircuito() {
        return circuito;
    }

    public void setCircuito(Circuito circuito) {
        this.circuito = circuito;
    }

    public Ponto getPonto() {
        return ponto;
    }

    public void setPonto(Ponto ponto) {
        this.ponto = ponto;
    }

    public Integer getOrdem() {
        return ordem;
    }

    public void setOrdem(Integer ordem) {
        this.ordem = ordem;
    }
}
